﻿using System;
using System.ComponentModel.DataAnnotations;

namespace OurWedding1.Models
{
    [MetadataType(typeof(HomePageParagraphBuddy))]
    public partial class HomePageParagraph
    {
        public string GetPositionLiterally()
        {
            string result;
            switch (Position)
            {
                case 0:
                    result = "zero";
                    break;
                case 1:
                    result = "one";
                    break;
                case 2:
                    result = "two";
                    break;
                case 3:
                    result = "three";
                    break;
                case 4:
                    result = "four";
                    break;
                case 5:
                    result = "five";
                    break;
                case 6:
                    result = "six";
                    break;
                case 7:
                    result = "seven";
                    break;
                case 8:
                    result = "eight";
                    break;
                case 9:
                    result = "nine";
                    break;

                default:
                    throw  new ArgumentException();
            }
            return result;
        }
    }
    public class HomePageParagraphBuddy
    {
      
        [Required(ErrorMessageResourceType = typeof (Resources), ErrorMessageResourceName = "HomePageParagraph_Name_Required")]
        [Display(ResourceType = typeof (Resources), Name = "HomePageParagraph_Name")]
        public string Name { get; set; }

        [Required(ErrorMessageResourceType = typeof (Resources), ErrorMessageResourceName = "HomePageParagraph_Position_Required")]
        [Display(ResourceType = typeof (Resources), Name = "HomePageParagraph_Position")]
        [Range(0, 9, ErrorMessageResourceType = typeof (Resources), ErrorMessageResourceName = "HomePageParagraph_Position_Range")]
        public int Position { get; set; }

        [Required(ErrorMessageResourceType = typeof (Resources), ErrorMessageResourceName = "HomePageParagraph_Content_Required")]
        [Display(ResourceType = typeof (Resources), Name = "HomePageParagraph_Content")]
        [DataType(DataType.Html)]
        public string Content { get; set; }

        [Required(ErrorMessageResourceType = typeof (Resources), ErrorMessageResourceName = "HomePageParagraph_IsPublished_Required")]
        [Display(ResourceType = typeof (Resources), Name = "HomePageParagraph_IsPublished")]
        public bool IsPublished { get; set; }

        [Display(ResourceType = typeof (Resources), Name = "HomePageParagraph_PublishedDate")]
        [DataType(DataType.Date)]
        public DateTime? PublishedDate { get; set; }

        [Display(ResourceType = typeof (Resources), Name = "HomePageParagraph_ControllerName")]
        public string ControllerName { get; set; }

        [Display(ResourceType = typeof (Resources), Name = "HomePageParagraph_ActionName")]
        public string ActionName { get; set; }

        [Display(ResourceType = typeof (Resources), Name = "HomePageParagraph_Parameter")]
        public int? Parameter { get; set; }
    }
}